<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta th:include="common/commons :: layui"/>
    <title>编辑账号</title>
    <style type="text/css">
        .layui-form-pane .layui-form-label {
            width: 200px;
        }

        .layui-form-pane .layui-input-block {
            margin-left: 200px;
        }
    </style>
</head>
<body style="text-align:center">
<div class="layui-fluid" style="margin-top: 20px">
    <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
    <form id="accountManageEdit" class="layui-form layui-form-pane" th:action="@{/user/edit}" method="post">
        <input type="hidden" th:value="${managerUser.id}" name="id"/>
        <div class="layui-form-item ">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="userName" th:value="${managerUser.userName}" required="required"/>
            </div>
        </div>
        <div class="layui-form-item ">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="password" th:value="${managerUser.password}" required="required"/>
            </div>
        </div>
        <div class="layui-form-item ">
            <label class="layui-form-label">真实姓名</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="realName" th:value="${managerUser.realName}" required="required"/>
            </div>
        </div>
        <div class="layui-form-item ">
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="phone" th:value="${managerUser.phone}" required="required"/>
            </div>
        </div>
        <div class="layui-form-item">
            <div style="margin:0 auto">
                <button class="layui-btn" type="submit">确定</button>
            </div>
        </div>
    </form>
    <!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
    <script type="text/javascript" th:inline="javascript">
        layui.use('form', function () {
            var form = layui.form;
            $("#accountManageEdit").ajaxForm(function (success) {
                if (success.code == 200) {
                    msg.success('修改成功', function () {
                        parent.window.location.reload();
                    });
                    // msg.success("修改成功");
                    // parent.window.location.reload();
                } else {
                    msg.error('修改失败', function () {
                        parent.window.location.reload();
                    });
                }
            })
        });

    </script>
</div>
</body>
</html>